package com.sc.nft.admin.controller;

import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.dto.IdRequest;
import com.sc.nft.dto.MerchantEnterpriseQualificationAuditDTO;
import com.sc.nft.feign.MerchantEnterpriseQualificationClient;
import com.sc.nft.sup.PageRequest;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import com.sc.nft.vo.MerchantEnterpriseQualificationDetailsVO;
import com.sc.nft.vo.MerchantEnterpriseQualificationPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 企业资质表(MerchantEnterpriseQualification)表控制层
 *
 * @author wwc
 * @since 2023-03-28 11:04:43
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("admin/merchantEnterpriseQualification")
@Api(tags = "企业资质操作")
public class MerchantEnterpriseQualificationController {

    private final MerchantEnterpriseQualificationClient merchantEnterpriseQualificationClient;

    @PostMapping(value = "/page", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "获取审核列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<MerchantEnterpriseQualificationPageVO> page(@RequestBody @Validated PageRequest pageRequest) {
        return merchantEnterpriseQualificationClient.page(pageRequest);
    }

    @PostMapping(value = "/getById", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "根据id获取资质审核详情", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result<MerchantEnterpriseQualificationDetailsVO> getById(@RequestBody @Validated IdRequest idRequest) {
        return merchantEnterpriseQualificationClient.getById(idRequest);
    }

    @PostMapping(value = "/audit", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "审核", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result audit(@RequestBody @Validated MerchantEnterpriseQualificationAuditDTO merchantEnterpriseQualificationAuditDTO) {
        return merchantEnterpriseQualificationClient.audit(merchantEnterpriseQualificationAuditDTO);
    }

}
